package cn.wbnyua.msm.util;

import lombok.Data;

/**
 * 作者：wbnyua.
 * 创建时间: 2023/2/8 22:28.
 */

@Data
public class JsonResponse<T> {

    private String code;
    private String message;
    private T data;

    public JsonResponse(String code,String message){
        this.code = code;
        this.message = message;
    }

    public JsonResponse(T data){
        this.data = data;
        this.code = "200";
        this.message = "成功";
    }

    public static JsonResponse<String> success(){
        return new JsonResponse<>("200","成功");
    }

    public static JsonResponse<String> success(String data){
        return new JsonResponse<>(data);
    }

    public static JsonResponse<String> failed(){
        return new JsonResponse<>("500","失败");
    }

    public static JsonResponse<String> failed(String code,String message){
        return new JsonResponse<>(code,message);
    }



}
